package practice.closestpointsproblem;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
	public Main() {
		Scanner s = new Scanner(System.in);
		while (s.hasNext()){
			int numNums = s.nextInt();
			if (numNums==0)
				return;

			points = new ArrayList<Point>();
			for (int i =0; i < numNums; i++){
				points.add(new Point(s.nextDouble(),s.nextDouble()));
			}
			double cd = getClosestDistance();
			if (cd <10000)
				System.out.printf("%.4f\n",cd);
			else
				System.out.println("INFINITY");
		}
	}
	/*
	 * BEGIN CLOSEST POINT CODE
	 * IF there is only 1 point, returns infinity
	 * does not check for 0 points.
	 * Currently does not sort on y.
	 */
	List<Point> points;
	
	public double getClosestDistance(){
		Collections.sort(points);
		return Math.sqrt(closestDistance(0,points.size()-1));
	}
	static double dist(Point b, Point e){
		return Math.pow(b.x-e.x, 2)+Math.pow(b.y-e.y, 2);
	}
	public double closestDistance(int start, int end){
		if (end-start==0)
			return Double.POSITIVE_INFINITY;
		if (end-start==2)
			return Math.min(	Math.min(	dist(points.get(start),points.get(start+1))	,	dist(points.get(start+2),points.get(start+1)))	,	dist(points.get(start),points.get(start+2)));
		if (end-start==1)
			return dist(points.get(start),points.get(start+1));

		double xmid, closestLeft,closestRight;
		int center = (start+end) / 2;

		closestLeft = closestDistance(start,center);
		closestRight = closestDistance(center+1,end);

		double min=Math.min(closestLeft, closestRight);

		xmid=points.get(center).x;
		int toLeft = center;
		while (toLeft >=start && Math.pow(xmid-points.get(toLeft).x,2) <= min){
			int toRight = center+1;
			while (toRight <= end && Math.pow(points.get(toRight).x-xmid,2) <= min){
				min = Math.min(min,	dist(points.get(toLeft),points.get(toRight)));
				toRight++;
			}
			toLeft--;
		}
		return min;
	}
	class Point implements Comparable<Point>{
		double x,y;
		public Point (double x,double y){
			this.x =x;
			this.y =y;
		}
		@Override
		public int compareTo(Point arg0) {
			if (x<arg0.x)
				return -1;
			if (x>arg0.x)
				return 1;
			else
				return 0;
		}
	}
	public static void main(String[] args) {
		new Main();
	}
}